#include <stdio.h>
#include <stdlib.h>
/**
*  Tutorial #5 (Data Structuring Case Study)
*  Program to find maximum and minimum of 'n' numbers
**/
int main1()
{
    int n,maximum,minimum,i,num1,num2,cond;
    printf("\nEnter the Value of n\n");
    scanf("%d",&n);
    cond = n/2;
    printf("\nEnter the numbers\n");
    scanf("%d",&maximum);
    if(n%2 == 0){
        scanf("%d",&minimum);
        if(minimum >= maximum){
           swapValues(&minimum,&maximum);
        }
        cond = cond - 1;
    }else{
        minimum = maximum;
    }
    for(i = 0;i < cond; i++){
        scanf("%d",&num1);
        scanf("%d",&num2);
        if(num1 > num2){
            if(num1 > maximum){
                maximum = num1;
            }else if(num2 < minimum){
                minimum = num2;
            }
        }else{
            if(num2 > maximum){
                maximum = num2;
            }else if(num1 < minimum){
                minimum = num1;
            }
        }
    }

    printf("\nLargest No is:%d and Smallest No is:%d\n",maximum,minimum);
}

void swapValues(int *minimum,int *maximum){
    int temp = *minimum;
    *minimum = *maximum;
    *maximum = temp;
}
